library(igraph)
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0 ✔ purrr 1.0.2
## ✔ tibble 3.2.1 ✔ dplyr 1.1.2
## ✔ tidyr 1.3.1 ✔ stringr 1.5.0
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## Warning: package 'tidyr' was built under R version 4.2.3
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::as_data_frame() masks tibble::as_data_frame(), igraph::as_data_frame()
## ✖ purrr::compose() masks igraph::compose()
## ✖ tidyr::crossing() masks igraph::crossing()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ purrr::simplify() masks igraph::simplify()
library(questionr)
#read file in as members
mt_edgelist <- read.csv("../data cleaning/all-data.csv")
View(mt_edgelist)
head(mt_edgelist)
Note: the sender is in the first column and receiver in the second
people <- filter(mt_edgelist, sourcetweet_type == "quoted" | is.na(sourcetweet_type))
print(unique(people$user_username))
## [1] "mathyadriana" "mathprofcarrie" "pwr2dppl" "xl772"
## [5] "WanderingPoint" "LoboWithACause" "qsideinstitute" "frontLahn"
## [9] "RachelleDeCoste" "monsoon0" "elizabethmunch" "MarissaKawehi"
## [13] "fra_berni" "HthrLynnJ" "sbagley" "thewordninja_bk"
## [17] "matthematician" "DrMRLD" "VictorPiercey1" "kmkinnaird"
## [21] "jensilvermath" "KJMDPhD" "MattBoelkins" "susan_dagostino"
## [25] "FedericoArdila" "MBarany" "DrBKirkpatrick" "CKalinecCraig"
## [29] "BikeMath" "evainfeld" "belladoesmath" "BenisConsumer"
## [33] "BresockCalculus" "katebelin" "joshlaison" "GailHWebster"
## [37] "JohannaF_math" "ClaudioJacobo" "virtualcourtney" "StatsSam"
## [41] "EWhitteck" "siwelwerd" "Shelby_M_Scott" "blkmathmagic"
## [45] "darrenglass" "SoledadVillar5" "diazlopezmath" "aksir"
## [49] "benjamindickman" "DrHenryGarrett" "mathcourtney" "kneppkatt"
## [53] "swirlgirl31415" "DrBrandyMath" "AliciaPL25" "GoodsiePhD"
## [57] "DamienSBS" "dtkung" "jacksonfulton2" "saracharala"
## [61] "DrClaireJanelle" "sleepymathgrl" "SuzanneSindi" "sister_stem"
## [65] "holom0rph" "mathillustrated" "achambertloir" "blviray"
## [69] "BillOpenmind" "Cayleygrapher" "tritesprite" "extremefriday"
## [73] "RG1gal" "KristinePelatt" "maryepilgrim" "malagonmath"
## [77] "ef_math" "matthewando"
#Careful, this overcounts! The 'text' field is truncated for retweets, need to load
#new data file that includes sourcetweet_text field
JointMath<-mt_edgelist[mt_edgelist$user_username == 'JointMath',]
#did not use any of the hashtags or did not include a @JointMath tag
NotHT20<-subset(JointMath, !grepl("#JMM2020", JointMath$sourcetweet_text ), )
NotHT<-subset(NotHT20, !grepl("#JMM2021", NotHT20$sourcetweet_text ), )
Notpinged<-subset(NotHT, !grepl("@JointMath", NotHT$sourcetweet_text ))
# for example - this has nothing that says RT me...
Notpinged$text[12]
## [1] "RT @blkmathmagic: The SECOND #DisruptJMM slide from @mathprofcarrie\n: Math is not neutral\n\nThe more there are, the more comfortable I feel…"
Notpinged
Clearly the JointMath handle was RTing JMM tweets
influencer_names = c("WanderingPoint","mathprofcarrie","sbagley","pwr2dppl","RG1gal","LoboWithACause","VictorPiercey1")
#influencers <- filter(mt_edgelist, user_username %in% influencer_names)
codes <- colnames(mt_edgelist)[54:88]
for (person in influencer_names) {
influencers <- filter(mt_edgelist, user_username == person)
#Drop retweets
influencersOTQT <- filter(influencers, sourcetweet_type == "quoted" | is.na(sourcetweet_type))
n=nrow(influencersOTQT)
influencer_tweets <- c()
cnames <- c()
for (code in codes) {
freq=length(which(influencersOTQT[code]=="True"))/n
if (freq>0){
influencer_tweets <- append(influencer_tweets,freq)
cnames <- append(cnames,code)}
}
names(influencer_tweets) <- cnames
influencer_tweets <- sort(influencer_tweets,decreasing=TRUE)
print(person)
print(n)
print(knitr::kable(influencer_tweets))
cat("\n\n")
}
## [1] "WanderingPoint"
## [1] 10
##
##
## | | x|
## |:------------------|---:|
## |amplification | 0.6|
## |talk.support | 0.5|
## |hashtags | 0.4|
## |representation | 0.3|
## |indigenous | 0.3|
## |influencers | 0.2|
## |emotional.support | 0.2|
## |BC.impact | 0.2|
## |SO.impact | 0.2|
## |conversation | 0.2|
## |jmm.experience | 0.2|
## |gender | 0.1|
## |advocacy | 0.1|
## |CC.impact | 0.1|
## |math.practice | 0.1|
## |strategic.planning | 0.1|
## |humanize | 0.1|
## |allyship.in.math | 0.1|
##
##
## [1] "mathprofcarrie"
## [1] 47
##
##
## | | x|
## |:---------------------|---------:|
## |talk.support | 0.3829787|
## |conversation | 0.3617021|
## |amplification | 0.3404255|
## |hashtags | 0.1914894|
## |strategic.planning | 0.1914894|
## |influencers | 0.1702128|
## |BC.impact | 0.1702128|
## |representation | 0.1489362|
## |bipoc | 0.1063830|
## |power | 0.1063830|
## |thankful | 0.0851064|
## |belonging | 0.0851064|
## |indigenous | 0.0638298|
## |gender | 0.0425532|
## |emotional.support | 0.0425532|
## |math.practice | 0.0425532|
## |lgbtq | 0.0212766|
## |SO.impact | 0.0212766|
## |learning | 0.0212766|
## |virtual.participation | 0.0212766|
## |humanize | 0.0212766|
## |allyship.in.math | 0.0212766|
## |math.experience | 0.0212766|
## |futures | 0.0212766|
## |activation | 0.0212766|
##
##
## [1] "sbagley"
## [1] 42
##
##
## | | x|
## |:----------------|---------:|
## |hashtags | 0.6666667|
## |influencers | 0.6428571|
## |amplification | 0.5714286|
## |talk.support | 0.5238095|
## |humanize | 0.2619048|
## |power | 0.2380952|
## |math.practice | 0.2142857|
## |lgbtq | 0.1904762|
## |advocacy | 0.1904762|
## |bipoc | 0.1190476|
## |representation | 0.0952381|
## |BC.impact | 0.0952381|
## |learning | 0.0476190|
## |economic | 0.0476190|
## |gender | 0.0238095|
## |belonging | 0.0238095|
## |conversation | 0.0238095|
## |allyship.in.math | 0.0238095|
##
##
## [1] "pwr2dppl"
## [1] 34
##
##
## | | x|
## |:------------------|---------:|
## |hashtags | 0.5000000|
## |amplification | 0.2941176|
## |talk.support | 0.2647059|
## |BC.impact | 0.2647059|
## |strategic.planning | 0.2352941|
## |influencers | 0.2058824|
## |representation | 0.2058824|
## |power | 0.2058824|
## |indigenous | 0.1470588|
## |conversation | 0.1470588|
## |bipoc | 0.1176471|
## |emotional.support | 0.1176471|
## |current.events | 0.1176471|
## |gender | 0.0588235|
## |thankful | 0.0588235|
## |SO.impact | 0.0588235|
## |belonging | 0.0588235|
## |humanize | 0.0588235|
## |jmm.experience | 0.0588235|
## |advocacy | 0.0294118|
## |learning | 0.0294118|
##
##
## [1] "RG1gal"
## [1] 2
##
##
## | | x|
## |:-------------|---:|
## |talk.support | 0.5|
## |influencers | 0.5|
## |math.practice | 0.5|
## |conversation | 0.5|
## |humanize | 0.5|
## |futures | 0.5|
##
##
## [1] "LoboWithACause"
## [1] 16
##
##
## | | x|
## |:---------------------|------:|
## |amplification | 0.5625|
## |hashtags | 0.3125|
## |representation | 0.2500|
## |BC.impact | 0.2500|
## |strategic.planning | 0.2500|
## |thankful | 0.1875|
## |talk.support | 0.1250|
## |advocacy | 0.1250|
## |belonging | 0.1250|
## |power | 0.1250|
## |jmm.experience | 0.1250|
## |bipoc | 0.0625|
## |gender | 0.0625|
## |influencers | 0.0625|
## |emotional.support | 0.0625|
## |SO.impact | 0.0625|
## |virtual.participation | 0.0625|
## |math.practice | 0.0625|
## |humanize | 0.0625|
## |math.experience | 0.0625|
##
##
## [1] "VictorPiercey1"
## [1] 14
##
##
## | | x|
## |:------------------|---------:|
## |talk.support | 0.5714286|
## |amplification | 0.5714286|
## |hashtags | 0.4285714|
## |influencers | 0.2857143|
## |math.practice | 0.2857143|
## |belonging | 0.1428571|
## |power | 0.1428571|
## |strategic.planning | 0.1428571|
## |humanize | 0.1428571|
## |gender | 0.0714286|
## |representation | 0.0714286|
## |BC.impact | 0.0714286|
## |SO.impact | 0.0714286|
## |indigenous | 0.0714286|
## |SJEDI.impact | 0.0714286|
## |allyship.in.math | 0.0714286|
## |disrupteverything | 0.0714286|
top_people = data.frame( name= c("WanderingPoint","mathprofcarrie","sbagley","pwr2dppl","LoboWithACause","VictorPiercey1"))
#influencers <- filter(mt_edgelist, user_username %in% influencer_names)
print(top_people)
## name
## 1 WanderingPoint
## 2 mathprofcarrie
## 3 sbagley
## 4 pwr2dppl
## 5 LoboWithACause
## 6 VictorPiercey1
codes <- c("representation","lbgtq","bipoc","gender","indigenous","power","advocacy","learning","economic","SJEDI.impact","humanize","jmm.experience","math.experience","futures","math.practice","current.events","allyship.in.math","CC.impact")
for (code in codes) {
column = c()
for (person in top_people$name){
influencers <- filter(filter(mt_edgelist, user_username == person), sourcetweet_type == "quoted" | is.na(sourcetweet_type))
#Drop retweets
# influencersOTQT <- filter(influencers, sourcetweet_type == "quoted" | is.na(sourcetweet_type))
n=nrow(influencers)
freq=length(which(influencers[[code]]=="True"))/n
column <- append(column,freq)
}
top_people[[code]] <- column
}
#num=c()
#for (person in top_people$name){
# num <- append(num, nrow(filter(filter(mt_edgelist, user_username == person), sourcetweet_type == "quoted" | is.na(sourcetweet_type))))
#}
#top_people$n <- num
#print(top_people)
top_people %>%
pivot_longer(cols = codes, names_to="code") %>%
ggplot(aes(code, value, fill = name)) +
geom_col(position = position_dodge(), color = "black") +
#scale_alpha_manual(values = c(0.5, 1), guide = guide_none()) +
facet_grid(~code, scales = "free_x", switch = "x") +
theme(strip.placement = "outside",
panel.spacing = unit(0, "points"),
strip.background = element_blank(),
axis.text.x=element_blank(),
strip.text.x = element_text(angle = 90)
#axis.ticks.x=element_blank()
) +
#strip.text = element_text(face = "bold", size = 12)) +
labs(x = "Codes")
## Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.
## ℹ Please use `all_of()` or `any_of()` instead.
## # Was:
## data %>% select(codes)
##
## # Now:
## data %>% select(all_of(codes))
##
## See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
influencer_names = c("mathprofcarrie","JointMath","pwr2dppl","LoboWithACause","sbagley")
#influencers <- filter(mt_edgelist, user_username %in% influencer_names)
codes <- colnames(mt_edgelist)[54:88]
for (person in influencer_names) {
influencers <- filter(mt_edgelist, user_username == person)
#Drop retweets
#influencersOTQT <- filter(influencers, sourcetweet_type == "quoted" | is.na(sourcetweet_type))
n=nrow(influencers)
influencer_tweets <- c()
cnames <- c()
for (code in codes) {
freq=length(which(influencers[code]=="True"))/n
if (freq>0){
influencer_tweets <- append(influencer_tweets,freq)
cnames <- append(cnames,code)}
}
names(influencer_tweets) <- cnames
influencer_tweets <- sort(influencer_tweets,decreasing=TRUE)
print(person)
print(n)
print(knitr::kable(influencer_tweets))
cat("\n\n")
}
## [1] "mathprofcarrie"
## [1] 126
##
##
## | | x|
## |:---------------------|---------:|
## |amplification | 0.5476190|
## |talk.support | 0.4682540|
## |hashtags | 0.3730159|
## |influencers | 0.2619048|
## |representation | 0.1984127|
## |conversation | 0.1587302|
## |strategic.planning | 0.1349206|
## |power | 0.1269841|
## |BC.impact | 0.1190476|
## |indigenous | 0.1111111|
## |thankful | 0.0952381|
## |humanize | 0.0952381|
## |bipoc | 0.0873016|
## |gender | 0.0873016|
## |math.practice | 0.0714286|
## |advocacy | 0.0555556|
## |learning | 0.0476190|
## |allyship.in.math | 0.0396825|
## |lgbtq | 0.0317460|
## |belonging | 0.0317460|
## |current.events | 0.0317460|
## |emotional.support | 0.0238095|
## |SO.impact | 0.0238095|
## |CC.impact | 0.0158730|
## |math.experience | 0.0158730|
## |jmm.experience | 0.0158730|
## |disrupteverything | 0.0158730|
## |virtual.participation | 0.0079365|
## |futures | 0.0079365|
## |economic | 0.0079365|
## |activation | 0.0079365|
##
##
## [1] "JointMath"
## [1] 85
##
##
## | | x|
## |:---------------------|---------:|
## |talk.support | 0.6588235|
## |amplification | 0.5411765|
## |influencers | 0.4588235|
## |hashtags | 0.4588235|
## |representation | 0.1882353|
## |math.practice | 0.1411765|
## |humanize | 0.1294118|
## |thankful | 0.1176471|
## |BC.impact | 0.1058824|
## |gender | 0.0941176|
## |indigenous | 0.0941176|
## |power | 0.0823529|
## |strategic.planning | 0.0823529|
## |advocacy | 0.0705882|
## |bipoc | 0.0470588|
## |lgbtq | 0.0470588|
## |conversation | 0.0470588|
## |allyship.in.math | 0.0470588|
## |belonging | 0.0352941|
## |learning | 0.0352941|
## |SO.impact | 0.0235294|
## |CC.impact | 0.0235294|
## |jmm.experience | 0.0235294|
## |emotional.support | 0.0117647|
## |SJEDI.impact | 0.0117647|
## |virtual.participation | 0.0117647|
## |math.experience | 0.0117647|
## |futures | 0.0117647|
## |activation | 0.0117647|
## |current.events | 0.0117647|
##
##
## [1] "pwr2dppl"
## [1] 101
##
##
## | | x|
## |:------------------|---------:|
## |amplification | 0.5049505|
## |talk.support | 0.4158416|
## |hashtags | 0.3861386|
## |influencers | 0.2772277|
## |representation | 0.1980198|
## |BC.impact | 0.1485149|
## |power | 0.1485149|
## |strategic.planning | 0.1485149|
## |bipoc | 0.1188119|
## |indigenous | 0.1188119|
## |humanize | 0.1188119|
## |math.practice | 0.1089109|
## |thankful | 0.0891089|
## |gender | 0.0792079|
## |advocacy | 0.0792079|
## |lgbtq | 0.0693069|
## |emotional.support | 0.0693069|
## |SO.impact | 0.0594059|
## |conversation | 0.0594059|
## |jmm.experience | 0.0594059|
## |current.events | 0.0594059|
## |belonging | 0.0495050|
## |CC.impact | 0.0198020|
## |math.experience | 0.0198020|
## |SJEDI.impact | 0.0099010|
## |learning | 0.0099010|
## |allyship.in.math | 0.0099010|
## |activation | 0.0099010|
##
##
## [1] "LoboWithACause"
## [1] 48
##
##
## | | x|
## |:---------------------|---------:|
## |amplification | 0.6250000|
## |talk.support | 0.4791667|
## |hashtags | 0.3333333|
## |representation | 0.2083333|
## |influencers | 0.1666667|
## |power | 0.1666667|
## |strategic.planning | 0.1666667|
## |indigenous | 0.1458333|
## |humanize | 0.1458333|
## |gender | 0.1250000|
## |thankful | 0.1250000|
## |BC.impact | 0.1041667|
## |advocacy | 0.1041667|
## |belonging | 0.1041667|
## |math.practice | 0.1041667|
## |bipoc | 0.0833333|
## |lgbtq | 0.0625000|
## |allyship.in.math | 0.0625000|
## |emotional.support | 0.0416667|
## |math.experience | 0.0416667|
## |jmm.experience | 0.0416667|
## |SO.impact | 0.0208333|
## |virtual.participation | 0.0208333|
## |conversation | 0.0208333|
## |futures | 0.0208333|
## |current.events | 0.0208333|
##
##
## [1] "sbagley"
## [1] 60
##
##
## | | x|
## |:------------------|---------:|
## |amplification | 0.6166667|
## |talk.support | 0.5500000|
## |hashtags | 0.5333333|
## |influencers | 0.5166667|
## |humanize | 0.2166667|
## |power | 0.2000000|
## |lgbtq | 0.1666667|
## |math.practice | 0.1666667|
## |advocacy | 0.1500000|
## |bipoc | 0.1000000|
## |representation | 0.1000000|
## |gender | 0.0666667|
## |BC.impact | 0.0666667|
## |allyship.in.math | 0.0666667|
## |thankful | 0.0500000|
## |current.events | 0.0500000|
## |indigenous | 0.0333333|
## |belonging | 0.0333333|
## |learning | 0.0333333|
## |strategic.planning | 0.0333333|
## |economic | 0.0333333|
## |emotional.support | 0.0166667|
## |conversation | 0.0166667|
## |math.experience | 0.0166667|
#What was @JointMath tweeting about?
jointmath <- filter(mt_edgelist, user_username == "JointMath")
n=nrow(jointmath)
codes <- colnames(jointmath)[54:88]
joint_tweets <- c()
for (code in codes) {
joint_tweets <- append(joint_tweets, length(which(jointmath[code]=="True"))/n)
}
names(joint_tweets) <- codes
joint_tweets <- sort(joint_tweets,decreasing=TRUE)
print(joint_tweets)
## talk.support amplification influencers
## 0.65882353 0.54117647 0.45882353
## hashtags representation math.practice
## 0.45882353 0.18823529 0.14117647
## humanize thankful BC.impact
## 0.12941176 0.11764706 0.10588235
## gender indigenous power
## 0.09411765 0.09411765 0.08235294
## strategic.planning advocacy bipoc
## 0.08235294 0.07058824 0.04705882
## lgbtq conversation allyship.in.math
## 0.04705882 0.04705882 0.04705882
## belonging learning SO.impact
## 0.03529412 0.03529412 0.02352941
## CC.impact jmm.experience emotional.support
## 0.02352941 0.02352941 0.01176471
## SJEDI.impact virtual.participation math.experience
## 0.01176471 0.01176471 0.01176471
## futures activation current.events
## 0.01176471 0.01176471 0.01176471
## disrupteverything economic celebration
## 0.00000000 0.00000000 0.00000000
## troll beyond
## 0.00000000 0.00000000
print(n)
## [1] 85
#important_codes <- c("representation","gender","indigenous","advocacy","power","bipoc")
#
#for (code in important_codes){
# code_only <- filter(mt_edgelist, (!!as.symbol(code))=="True")
# print(code)
# top_tweeters=sort(table(code_only$user_username),decreasing=TRUE)
#print(head(top_tweeters,10))
# barplot(head(top_tweeters,10),las=2)
#}
themes=c("SJEDI","Creating.change.in.math", "Building.community", "Broadening.the.counterpublic", "Self.organization")
for (theme in themes){
print(theme)
code_only <- filter(filter(mt_edgelist, (!!as.symbol(theme))==1), sourcetweet_type == "quoted" | is.na(sourcetweet_type))
top_tweeters=sort(wtd.table(x=code_only$user_username, weights=1+code_only$retweet_count+code_only$quote_count),decreasing=TRUE)
barplot(head(top_tweeters,10),las=2)
}
## [1] "SJEDI"
## [1] "Creating.change.in.math"
## [1] "Building.community"
## [1] "Broadening.the.counterpublic"
## [1] "Self.organization"
# Who is tweeting about SJEDI and CC in Math? unweighted version
themes=c("SJEDI","Creating.change.in.math", "Building.community", "Broadening.the.counterpublic", "Self.organization")
for (theme in themes){
print(theme)
code_only <- filter(filter(mt_edgelist, (!!as.symbol(theme))==1), sourcetweet_type == "quoted" | is.na(sourcetweet_type))
#top_tweeters=sort(wtd.table(x=code_only$user_username, weights=1+code_only$retweet_count+code_only$quote_count),decreasing=TRUE)
top_tweeters=sort(table(code_only$user_username),decreasing=TRUE)
barplot(head(top_tweeters,10),las=2)
}
## [1] "SJEDI"
## [1] "Creating.change.in.math"
## [1] "Building.community"
## [1] "Broadening.the.counterpublic"
## [1] "Self.organization"
codes <- colnames(mt_edgelist)[54:88]
for (code in codes){
print(code)
code_only <- filter(filter(mt_edgelist, (!!as.symbol(code))=="True"), sourcetweet_type == "quoted" | is.na(sourcetweet_type))
#Weighted
#top_tweeters=sort(wtd.table(x=code_only$user_username, weights=1+code_only$retweet_count+code_only$quote_count),decreasing=TRUE)
#Unweighted
top_tweeters=sort(table(code_only$user_username),decreasing=TRUE)
barplot(head(top_tweeters,5),las=2)
}
## [1] "bipoc"
## [1] "gender"
## [1] "lgbtq"
## [1] "talk.support"
## [1] "amplification"
## [1] "influencers"
## [1] "representation"
## [1] "thankful"
## [1] "emotional.support"
## [1] "BC.impact"
## [1] "SO.impact"
## [1] "hashtags"
## [1] "indigenous"
## [1] "advocacy"
## [1] "CC.impact"
## [1] "SJEDI.impact"
## [1] "belonging"
## [1] "learning"
## [1] "virtual.participation"
## [1] "power"
## [1] "math.practice"
## [1] "strategic.planning"
## [1] "conversation"
## [1] "humanize"
## [1] "allyship.in.math"
## [1] "math.experience"
## [1] "jmm.experience"
## [1] "futures"
## [1] "disrupteverything"
## [1] "economic"
## [1] "activation"
## [1] "current.events"
## [1] "celebration"
## [1] "troll"
## [1] "beyond"